#include<bits/stdc++.h>

using namespace std;
typedef long long ll;
int a[10] = {0, 1, 2};
int book[10];//标记数组
int n;

void dfs(int k) {
    if (k >= 10) {//已经处于二叉树的叶子结点 需要
        copy(book + 1, book + 10, ostream_iterator<int>(cout, ""));
        cout << endl;
        int tot = 0;
        for (int i = 1; i <= 9; i++) {
            tot += a[i];
        }
        if (tot == n) {
            cout << "ok" << endl;
        }
        return;//非常重要

    }
    book[k] = 0;//不使用a[0]
    dfs(k + 1);
    book[k] = 1;//使用了a[0]
    dfs(k + 1);

}


int main() {
    n = 129;
    for (int i = 3; i <= 9; i++)a[i] = a[i - 1] * i;
    dfs(1);

    return 0;
}